﻿//************************************************************************
//* Written by Jirat Boomuang
//* Filename: AdaRandomUtils.cs
//* Revision: 1.0
//* Author: JiratB
//* Platform: .NET Framework 4.0
//* Description: Various random utilities.
//* Note: Ada is my lovely daughter. 
//************************************************************************

//************************************************************************
//* Revision History
//------------------------------------------------------------------------
//* Revision  Date      Signature    Description
//------------------------------------------------------------------------
//* 1.0       20130119  JiratB       - First release to Codeplex
//************************************************************************

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AdaCRMUtilities
{
    public class AdaRandomUtils
    {
        static public string RandomUpperCase(int digit)
        {
            string s = "";
            char ch;

            Random rand = new Random();

            for (int i = 0; i < digit; ++i)
            {
                ch = Convert.ToChar(
                        Convert.ToInt32(
                            rand.Next(65,65+26)
                        )
                    );
                s = s + ch;
            }//-- end of for --

            return s;
        }//-- end of RandomUpperCase() --

        static public string RandomNumber(int digit)
        {
            string s = "";
            char ch;

            int ASCII0 = Convert.ToInt32('0');

            Random rand = new Random();           

            for (int i = 0; i < digit; ++i)
            {
                ch = Convert.ToChar(
                        Convert.ToInt32(
                            rand.Next(ASCII0, ASCII0 + 10)
                        )
                    );
                s = s + ch;
            }//-- end of for --

            return s;
        }//-- end of RandomNumber() --

        static public string RandomPhoneNumber(string countryCode, string areaCode, int digit)
        {
            string s = countryCode + areaCode + RandomNumber(digit);

            return s;
        }//-- end of RandomPhoneNumber() --

        static public int RandomInt(int min, int max)
        {
            Random rand = new Random();

            return rand.Next(min, max);
        }//-- End of RandomInt() --

    }//-- End of AdaRandomUtils --
}

//************************************************************************
// End of file
//************************************************************************